home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / DalHelper / Rexx / DalHelper.amirx next >
Text File  |  2000-05-23  |  15KB  |  16 lines

  1. /* DalHelper.amirx
  2. \\ $VER: DalHelper.amirx 5.25 (23.05.00)
  3. // Written by Donald T. Becker (dtbecker@prolog.net) IRC: StarDustr
  4. \\ Please mail any bug reports/comments to the above address with a subject
  5. // header of DalHelper.amirx.
  6. \\
  7. // ** What to do with this file?
  8. \\ Put this script in AmIRC/Rexx
  9. //  Make the following Aliases:
  10. \\
  11. //  /Alias  CS    /Rx DalHelper C %p
  12. \\  /Alias  MS    /Rx DalHelper M %p
  13. //  /Alias  NS    /Rx DalHelper N %p
  14. \\  /Alias  IDALL /Rx DalHelper IDALL
  15. */
  16. ;parse arg argline;parse value argline with j1 j2 j3 j4 j5 j6;if upper(j2)='ABOUT'|upper(j1)='ABOUT' then;do;call About();exit;end;if upper(j2)='DEBUG' then;do;call setclip("DHDebug",1);exit;end;if upper(j2)='NODEBUG' then;do;call setclip("DHDebug");exit;end;j1=upper(j1);k1=left(j1,3);x1=left(upper(j2),3);x2=left(upper(j2),2);if j1 ~='M'&j1 ~='N'&j1 ~='C'&j1 ~='QUIT'&k1 ~='IDA' then exit;if j1='QUIT' then;do;call setclip("DALHG_Title");call setclip("DALHG_Version");call setclip("DALHG_Copyright");call setclip("DALHG_Author");call setclip("DALHG_Description");exit;end;if j1='C' then DalDest="CHANSERV";if j1='M' then DalDest="MEMOSERV";if j1='N' then DalDest="NICKSERV";DalVer="$VER: DalHelper 5.25 (23.05.00)";if ~show('c',"DALHG_Title") then;do;setclip("DALHG_Title","DalHelper");setclip("DALHG_Version", DalVer);setclip("DALHG_Copyright","December 1996  by StarDustr");setclip("DALHG_Author","StarDustr  @Dal.net on #AmIRC");setclip("DALHG_Description","An Easy to Use Interface to Dalnet Services");end;CCmd1="ACCess, AKAdd, AKWipe, AKDel, AKList, AOAdd, AODel,  AOList";CCmd2="AOWipe, COunt, DOP, DRop, HElp, IDentify, INfo, INVite, MDeop, MKick, OP,";CCmd3="PAsswd, REGister, SDEsc, SIDent, SKTopic, SLOps, SMEmo, SMLock, SOAdd, SODel";CCmd4="SOList, SOWipe, SOGuard, SPRivate, SREstrict, STLlock, SURl, SUSecure, UNban, WHy";MCmd1="DAll, DElete, FOrward, HElp, LIst, NEws, PUrge, REad, SEnd, SESop, UNdel.";NCmd1="AAdd, ADel, AList, DRop, GHost, HElp, IDentify, INfo,";NCmd2="NOP, PAsswd, RECover, REGister, RELease, SKIll, SNMemo, SURl.";if ~show('L',"rexxsupport.library") then;if ~addlib("rexxsupport.library",0,-30,0) then exit;if show('c',"DHDebug") then;"echo P = "d2c(27)"««DalHelper»" ":Starting with" argline;if j1='M'|(x1 ~="INV"&(x2="IN"|x2="HE")) then signal NoNeed;ReadFile=1;fname="";xx=' '||showlist('a',,' ')||' '||showlist('v',,' ')||' ';if 0 ~=pos(' MCF ',xx) then;if exists("MCF:MCF.Dal") then;fname="MCF:MCF.Dal";if exists("MCF.Dal") then;fname="MCF.Dal";if 0 ~=pos(' DALHELPER ',xx) then;if exists("DalHelper:MCF.Dal") then;fname="DalHelper:MCF.Dal";if fname="" then fname="MCF.Dal";if ~open("Input",fname,'r') then;do;fname="MCF.Dal";address command "Echo >"fname DalVer;ReadFile=0;end;ccnt=0;ncnt=0;if ReadFile then;do;do mcnt=1 by 1 until eof("Input");xx=readln("Input");Dal.mcnt=xx;Byte1=left(xx,1);select;when Byte1='$' then continue;when Byte1='#' then;do;ccnt=ccnt+1;parse value xx with Chan.ccnt CPass.ccnt TRest.mcnt;end;when Byte1 ~=' ' then;do;ncnt=ncnt+1;parse value xx with Nick.ncnt NPass.ncnt TRest.mcnt;end;otherwise continue;end;end mcnt;call close("Input");end;options results;getchannel;CurChan=result;getmynick;MyNick=result;if k1='IDA' then signal IdAll;j6=strip(j6,'B');if j1='M' then;do;if x1='SES' then;do;Chan=j3;if left(j3,1)='#' then;j3="";else Chan=CurChan;end;if x2='FO' then;do;if j3="" then CPas="";if j3='-' then;do;CPas='-';j3="";end;if j3 ~="" then;do;Name=upper(j3);do cntn=1 by 1 until cntn=ncnt;if upper(Nick.cntn)=Name then;do;CPas=Nick.cntn NPass.cntn;cntn=ncnt;end;end;end;end;end;if j1='N' then;do;who=upper(MyNick);if j3 ~="" then Name=upper(j3);if j3="" then;do;Name=upper(MyNick);if x1 ~='SUR' then j3=Name;end;if 0=pos('@',Name) then;do;do cntn=1 by 1 until cntn=ncnt;if upper(Nick.cntn)=Name then;do;CPas=Nick.cntn NPass.cntn;cntn=ncnt;end;end;end;end;if j1='C' then;do;if j3 ~="" then Chan=upper(j3);if j3="" then;do;Chan=upper(CurChan);j3=Chan;end;pl=pos('@',Chan)+pos('*',Chan);if pl=0 then;do;do cntc=1 by 1 until cntc>ccnt;if upper(Chan.cntc)=Chan then;do;CPas=Chan CPass.cntc;cntc=ccnt+1;end;end;end;end;if x1='REG'|x2='PA' then;do;RParm=j3;if j4 ~="" then RParm=RParm j4;if j5 ~="" then RParm=RParm j5;if j6 ~="" then RParm=RParm j6;if j1='C'&0=pos('#',RParm) then;do;call GetChan();RParm=Chan RParm;if j4="" then;do;if x1='REG' then RParm=RParm "My Channel";end;parse value RParm with j3 j4 junk;end;end;NoNeed:;select;when j6 ~="" then xhelp=j3 j4 j5 j6;when j5 ~="" then xhelp=j3 j4 j5;when j4 ~="" then xhelp=j3 j4;when j3 ~="" then xhelp=j3;otherwise xhelp="";end;select;when x2='DR' then "RAW "DalDest" :Drop" j3;when x2='HE' then "RAW "DalDest" :Help" xhelp;when x2='ID' then;do;if CPas ~="CPAS" then "RAW "DalDest" :Identify" CPas;end;when x2='IN'&x1 ~='INV' then "RAW "DalDest" :Info" j3;when x1='REG' then "RAW "DalDest" :Register" RParm;when j1='N' then select;when x2='PA' then "RAW "DalDest" :Set Passwd" RParm;when x2='AA' then "RAW "DalDest" :Access Add" j3;when x2='AD' then "RAW "DalDest" :Access Del" j3;when x2='AL' then "RAW "DalDest" :Access List" j3;when x2='GH' then "RAW "DalDest" :Ghost" CPas;when x1='NOP' then;do;if Name=0 then Name="OFF";if Name=1 then Name="ON";"RAW "DalDest" :Set NOOP" Name;end;when x1='REC' then;do;"RAW "DalDest" :Recover" CPas;"RAW "DalDest" :Release" CPas;end;when x1='REL' then "RAW "DalDest" :Release" CPas;when x1='SKI' then;do;if Name=0 then Name="OFF";if Name=1 then Name="ON";"RAW "DalDest" :SET KILL" Name;end;when x1='SNM' then;do;if Name=0 then Name="OFF";if Name=1 then Name="ON";"RAW "DalDest" :SET NOMEMO" Name;end;when x1='SUR' then "RAW "DalDest" :SET URL" j3;otherwise;do;"echo P = "d2c(27)"««DalHelper»" " "d2c(2)"NickServ"d2c(2)" commands are:" NCmd1;"echo P = "d2c(27)"««DalHelper»" ":"NCmd2;Call quit();end;end;when j1='C' then select;when x2='PA' then "RAW "DalDest" :Set" Chan "Passwd" Name;when x2='CO' then "RAW "DalDest" :COunt" Chan;when x2='MD' then "RAW "DalDest" :MDeop" Chan;when x2='MK' then "RAW "DalDest" :MKick" Chan;when x2='UN' then "RAW "DalDest" :UnBan" Chan;when x1='INV' then "RAW "DalDest" :INVITE" j3 MyNick;when x2='OP' then;do;call GetChan();"RAW "DalDest" :OP" Chan Name;end;when x2='WH' then;do;call GetChan();"RAW "DalDest" :Why" Chan Name;end;when x1='ACC' then;do;call GetChan();"RAW "DalDest" :ACC" Chan Name;end;when x1='AKA' then;do;call GetChan();"RAW "DalDest" :AKick" Chan "Add" Name;end;when x1='AKD' then;do;call GetChan();"RAW "DalDest" :AKick" Chan "Del" Name;end;when x1='AKL' then;do;call GetChan();"RAW "DalDest" :AKick" Chan "List";end;when x1='AKW' then;do;call GetChan();"RAW "DalDest" :AKick" Chan "WIPE";end;when x1='AOA' then;do;call GetChan();"RAW "DalDest" :AOP" Chan "Add" Name;end;when x1='AOD' then;do;call GetChan();"RAW "DalDest" :AOP" Chan "Del" Name;end;when x1='AOL' then;do;call GetChan();"RAW "DalDest" :AOP" Chan "List";end;when x1='AOW' then;do;call GetChan();"RAW "DalDest" :AOP" Chan "WIPE";end;when x1='DOP' then;do;call GetChan();"RAW "DalDest" :DEOP" Chan Name;end;when x1='SDE' then;do;call GetChan();"RAW "DalDest" :SET" Chan "DESC" Name;end;when x1='SML' then;do;call GetChan();"RAW "DalDest" :SET" Chan "MLOCK" Name;who=upper(Chan);end;when x1='SUR' then;do;call GetChan();"RAW "DalDest" :SET" Chan "URL" Name;who=upper(Chan);end;when x1='SKT' then;do;call GetChan();if Name=0 then Name="OFF";if Name=1 then Name="ON";"RAW "DalDest" :SET" Chan "KEEPTOPIC" Name;end;when x1='SID' then;do;call GetChan();if Name=0 then Name="OFF";if Name=1 then Name="ON";"RAW "DalDest" :SET" Chan "IDENT" Name;end;when x1='SME' then;do;call GetChan();select;when Name=1 then Name="AOP";when Name=2 then Name="SOP";when Name=3 then Name="FOUNDER";otherwise Name="NONE";end;"RAW "DalDest" :SET" Chan "MEMO" Name;end;when x1='SRE' then;do;call GetChan();if Name=0 then Name="OFF";if Name=1 then Name="ON";"RAW "DalDest" :SET" Chan "RESTRICT" Name;end;when x1='SLO' then;do;call GetChan();if Name=0 then Name="OFF";if Name=1 then Name="ON";"RAW "DalDest" :SET" Chan "LEAVEOPS" Name;end;when x1='SOG' then;do;call GetChan();if Name=0 then Name="OFF";if Name=1 then Name="ON";"RAW "DalDest" :SET" Chan "OPGUARD" Name;end;when x1='STL' then;do;call GetChan();if Name=0 then Name="OFF";if Name=1 then Name="SOP";if Name=2 then Name="FOUNDER";"RAW "DalDest" :SET" Chan "TOPICLOCK" Name;end;when x1='SPR' then;do;call GetChan();if Name=0 then Name="OFF";if Name=1 then Name="ON";"RAW "DalDest" :SET" Chan "PRIVATE" Name;end;when x1='SUS' then;do;call GetChan();if Name=0 then Name="OFF";if Name=1 then Name="ON";"RAW "DalDest" :SET" Chan "UNSECURE" Name;end;when x1='SOA' then;do;call GetChan();"RAW "DalDest" :SOP" Chan "Add" Name;end;when x1='SOD' then;do;call GetChan();"RAW "DalDest" :SOP" Chan "Del" Name;end;when x1='SOL' then;do;call GetChan();"RAW "DalDest" :SOP" Chan "List";end;when x1='SOW' then;do;call GetChan();"RAW "DalDest" :SOP" Chan "WIPE";end;otherwise;do;"echo P = "d2c(27)"««DalHelper»" " "d2c(2)"ChanServ"d2c(2)" commands are:" CCmd1;"echo P = "d2c(27)"««DalHelper»" ":"CCmd2;"echo P = "d2c(27)"««DalHelper»" ":"CCmd3;"echo P = "d2c(27)"««DalHelper»" ":"CCmd4;Call quit();end;end;when j1='M' then;do;select;when x2='DA' then "RAW "DalDest" :Del All";when x2='DE' then "RAW "DalDest" :Del" j3;when x2='FO' then "RAW "DalDest" :Forward" CPas;when x2='LI' then "RAW "DalDest" :List";when x2='NE' then "RAW "DalDest" :News";when x2='PU' then "RAW "DalDest" :Purge";when x2='RE' then "RAW "DalDest" :Read" j3;when x2='SE' then "RAW "DalDest" :Send" xhelp;when x1='SES' then "RAW "DalDest" :SendSOP" Chan xhelp;when x2='UN' then "RAW "DalDest" :UnDel" j3;otherwise "echo P = "d2c(27)"««DalHelper»" " "d2c(2)"MemoServ"d2c(2)" commands are:" MCmd1;end;Call quit();end;otherwise Call quit();end;clit="XxXxXxX";klit="XxXxXxX";llit="XxXxXxX";select;when x2='MK' then;do;klit=" IS COMPLETE";llit=" HAVE BEEN CLEARED.";elit=" IS EMPTY.";end;when x2='UN' then;do;klit=" IS COMPLETE";llit=" HAVE BEEN CLEARED.";elit=" IS EMPTY.";end;when x1='REG' then llit=" ";when x1='SML' then llit=" ";when x1='SUR' then llit=" ";when x2='DR' then llit=" ";when x2='PA' then llit=" ";otherwise Call quit();end;qflag='N';do until qflag ~='N';getline;if line.command='440' then Call quit();xxp=pos('!',line.prefix);if xxp=0 then iterate;lrest=upper(line.rest);getmynick;UNick=upper(result);nl=length(UNick);SNick=upper(left(line.prefix,nl));if SNick=UNick then;do;if lrest=':%DAL' then Call quit();end;pfix=left(upper(line.prefix),8);if pfix ~= DalDest then iterate;if line.command ~='NOTICE' then iterate;if upper(line.dest) ~=UNick then iterate;if 0 ~=pos(elit,lrest)|0 ~=pos(klit,lrest) then qflag='K';if 0 ~=pos(llit,lrest) then qflag='J';end;select;when x1='REG' then;do;if 0=pos("REGISTERED",lrest) then Call quit();if j1='N' then;do;j4=j3;j3=MyNick;end;call open("Output",fname,'A');oline=strip(j3 j4);if oline ~="" then;wlen=writeln("Output",j3 j4);call close("Output");end;when x2='DR' then;do;if 0=pos("OPPED",lrest) then Call quit();address command "Echo >"fname DalVer;scnt=1;if 0 ~=pos('$VER', Dal.1) then scnt=2;call open("Output",fname,'A');do ocnt=scnt by 1 while ocnt ~>mcnt;if 1=pos(upper(j3),upper(Dal.ocnt)) then iterate ocnt;oline=strip(Dal.ocnt);if oline ~="" then wlen=writeln("Output", Dal.ocnt);end ocnt;call close("Output");end;when x2='PA' then;do;if 0=pos(" HAS BEEN ",lrest) then Call quit();if j1='N' then;do;j4=j3;j3=MyNick;end;address command "Echo >"fname DalVer;scnt=1;if 0 ~=pos('$VER', Dal.1) then scnt=2;call open("Output",fname,'A');do ocnt=scnt by 1 until ocnt=mcnt;if 1=pos(upper(j3),upper(Dal.ocnt)) then Dal.ocnt=j3 j4||TRest.ocnt;oline=strip(Dal.ocnt);if oline ~="" then wlen=writeln("Output", Dal.ocnt);end ocnt;call close("Output");end;when x1='SML' then;do;if 0=pos("MODE",lrest) then Call quit();address command "Echo >"fname DalVer;scnt=1;if 0 ~=pos('$VER', Dal.1) then scnt=2;call open("Output",fname,'A');do ocnt=scnt by 1 until ocnt=mcnt;if 1=pos(who,upper(Dal.ocnt)) then;do;mpos=pos(' MODE ', Dal.ocnt);if mpos ~=0 then;do;m1=left(Dal.ocnt,mpos-1);m2= delword(substr(Dal.ocnt,mpos),1,2);Dal.ocnt=strip(m1) strip(m2);end;Dal.ocnt=strip(Dal.ocnt) 'MODE' strip(j3);end;oline=strip(Dal.ocnt);if oline ~="" then wlen=writeln("Output", Dal.ocnt);end ocnt;call close("Output");end;when x1='SUR' then;do;if 0=pos("LOCATION",lrest) then Call quit();address command "Echo >"fname DalVer;scnt=1;if 0 ~=pos('$VER', Dal.1) then scnt=2;call open("Output",fname,'A');do ocnt=scnt by 1 until ocnt=mcnt;if 1=pos(who,upper(Dal.ocnt)) then;do;mpos=pos(' URL ', Dal.ocnt);if mpos ~=0 then;do;m1=left(Dal.ocnt,mpos-1);m2= delword(substr(Dal.ocnt,mpos),1,2);Dal.ocnt=strip(m1) strip(m2);end;Dal.ocnt=strip(Dal.ocnt) 'URL' strip(j3);end;oline=strip(Dal.ocnt);if oline ~="" then wlen=writeln("Output", Dal.ocnt);end ocnt;call close("Output");end;when qflag='K' then;do;address command 'wait 10 sec';"Say /JOIN" Chan;end;when qflag='J' then "Say /JOIN" Chan;otherwise Call quit();end;Call quit();GetChan:;if 0 ~=pos('#',Chan) then Name=j4;if 0=pos('#',Chan) then;do;Chan=CurChan;Name=j3;end;return;IdAll:;if ncnt=0 then signal IdChans;qqq=1;UNick=upper(MyNick);if ncnt>1 then;do;do qcnt=1 by 1 until qcnt=ncnt;MNick=upper(Nick.qcnt);qflag='N';address command 'wait 3 sec';"RAW NickServ :Identify "Nick.qcnt NPass.qcnt;do until qflag ~='N';getline;lrest=upper(line.rest);if line.command='440' then Call quit();if line.command='433' then;do;if 0 ~=pos(Nick.qcnt,line.rest) then;do;qflag='Y';iterate;end;end;xxp=pos('!',line.prefix);if xxp=0 then iterate;SNick=upper(left(line.prefix,xxp-1));select;when SNick=MNick then;if lrest=':%DAL' then Call quit();when SNick='NICKSERV' then;if 0 ~=pos(MNick,lrest) then qflag='Y';otherwise iterate;end;end;end qcnt;IdChans:;channels;JChans=upper(result);if ccnt>0 then;do;do xcntr=1 by 1 until xcntr=ccnt;"RAW JOIN "Chan.xcntr;address command 'wait 2 sec';"RAW ChanServ :Identify "Chan.xcntr CPass.xcntr;"RAW CHANSERV OP" Chan.xcntr UNick;qflag='N';do until qflag ~='N';getline;lrest=upper(line.rest);if line.command='440' then Call quit();if datatype(line.command)='NUM' then iterate;xxp=pos('!',line.prefix);if xxp=0 then iterate;SNick=upper(left(line.prefix,xxp-1));select;when SNick=UNick then;if lrest=':%DAL' then Call quit();when SNick='CHANSERV' then;if upper(line.command)='MODE' then;if 0 ~=pos(UNick,lrest) then qflag='Y';otherwise iterate;end;end;if 0=pos(upper(Chan.xcntr),JChans) then "RAW PART "Chan.xcntr;end xcntr;end;exit;quit:;if show('c',"DHDebug") then;"echo P = "d2c(27)"««DalHelper»" ":Exiting from" argline;exit;About:;MCmd="";MRexx=showlist('A',MuiRexx)+showlist('V',MuiRexx);if MRexx then MRexx=exists("MuiRexx:MuiRexx");if exists("SYS:RexxC/MuiRexx") then MCmd="SYS:RexxC/MuiRexx";if MRexx then MCmd="MuiRexx:MuiRexx";if exists("SYS:Utilities/MuiRexx") then MCmd="SYS:Utilities/MuiRexx";if MCmd="" then;do;'Echo "MuiRexx not found.  EOJ."';exit;end;address command 'run >nil:' MCmd port 'DALHG';address command 'waitforport' 'DALHG';'say' '/rx mcf_about DALHG QUIT';exit